<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.springframework.org/schema/jdbc">
<head xmlns:th="http://www.thymeleaf.org" th:include="master::head">
    <title>计划中的作业</title>

</head>
<body>
<div class="container">
    <div class="row">
        <!--<div class="col-md-4">-->
        <!--</div>-->
        <div class="col-md-12">
            <table id="tb_jobs"></table>
        </div>

    </div>

    <div th:include="master::itemDel"></div>
</div>
<script th:inline="javascript">
    /*<![CDATA[*/
    $(function () {
        $("#btn_delete").click(function () {
            delItem(function () {
                var selectedRows = $('#tb_jobs').bootstrapTable('getSelections');
                var selectedIds = [];
                $.each(selectedRows, function (i, item) {
                    selectedIds.push(item.id);
                });
                if (selectedIds.length == 0) return false;

                $.ajax({
                    type: "Post",
                    cache: false,
                    contentType: "application/json",
                    url: global.contextPath + "/deleteSites",
                    data: JSON.stringify(selectedIds),
                    dataType: 'json',
                    success: function (result) {     //回调函数，result，返回值
                        if (result == true)
                            $('#tb_jobs').bootstrapTable('refresh');
                        else
                            alert("删除失败");
                    },
                    error: function (msg) {
                        alert(JSON.stringify(msg));
                    }
                });
            });
        });

        //1.初始化Table
        var TableInit = function () {
            var oTableInit = new Object();
            //初始化Table
            oTableInit.Init = function () {
                $('#tb_jobs').bootstrapTable($.extend(global.bootstrapTableOptions, {
                    url: global.contextPath + '/getRunningJobList?random='+Math.random(),         //请求后台的URL（*）
                    method: 'get',                      //请求方式（*）
                    uniqueId: "jobId",
                    sidePagination: "client",           //分页方式：client客户端分页，server服务端分页（*）
                    detailView: false,          //是否显示父子表
                    cardView: true,                    //是否显示详细视图
                    columns: [{
                        field: 'jobName',
                        title: '作业名称'
                    },
                        {
                            field: 'jobGroup',
                            title: '组名'
                        }, {
                            field: 'jobStatus',
                            title: '状态'
                        },
                        {
                            field: 'cronExpression',
                            title: '定时表达式'
                        }, {
                            field: 'description',
                            title: '作业描述'
                        }
                    ]
                }));
            };
            return oTableInit;
        };
        var oTable = new TableInit();
        oTable.Init();
    });
    /*]]>*/
</script>

</body>
</html>